package cn.yuanqiao.archive.storeRoom.domain;



import cn.yuanqiao.common.annotation.IdAnnotation;
import cn.yuanqiao.common.core.domain.BaseEntity;
import cn.yuanqiao.common.utils.SecurityUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import org.apache.commons.lang.StringUtils;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author GW
 * @since 2024-04-16
 */
@Data
@AllArgsConstructor
@Builder
public class TechnicalTreatment extends BaseEntity {

    private static final long serialVersionUID = 1L;

    private final String BIGTABLENAME = "_TECHNICAL_TREATMENT";

    private final String TREATMENTYQBOXTABLE = "_TREATMENT_YQBOX";

    private String tableName;

    private String treatmentYqBoxTableName;

    public TechnicalTreatment() {
        String tenantCode = SecurityUtils.getTenantCode();
        if(StringUtils.isEmpty(tenantCode)){
            this.tableName = "_TECHNICAL_TREATMENT";
            this.treatmentYqBoxTableName = "_TREATMENT_YQBOX";
        }else {
            this.tableName = tenantCode.toUpperCase() + BIGTABLENAME;
            this.treatmentYqBoxTableName = tenantCode.toUpperCase() + TREATMENTYQBOXTABLE;
        }
        this.createTime = new Date();
        this.createUser = SecurityUtils.getUsername();
    }

    @IdAnnotation
    private Long id;

    /**
     * 任务类型
     * 3.数字化
     * 4.缩微
     * 5.修复
     * 6.保护技术处理
     * 7.其他情况
     */
    private String taskType;

    /**
     * 批次号
     */
    private String batchNum;

    /**
     * 任务名称
     */
    private String taskName;

    /**
     * 任务负责人
     */
    private String taskLeader;
    /**
     * 任务状态
     * 1.未开始
     * 2.进行中
     * 3.已完成
     */
    private String taskStatus;

    /**
     * 任务开始时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date taskStart;

    /**
     * 任务结束时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date taskEnd;

    /**
     * 备注
     */
    private String remark;

    /**
     * 创建人
     */
    private String createUser;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;

    /**
     * 更新人
     */
    private String updateUser;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date updateTime;

    /**
     * 逻辑删除
     */
    private String isDeleted;

    /**
     * 档案list
     */
    private List<UpDownShelves> upDownShelvesList;

}
